//
//  BCOrderDetailVC.m
//  BangcaiDriver
//
//  Created by lsy on 16/8/22.
//  Copyright © 2016年 BC. All rights reserved.
//

#import "BCOrderDetailVC.h"
#import "BCOderDetailView.h"
#import "BCPhonePopView.h"
#import "BCCheckMapVC.h"

@interface BCOrderDetailVC ()<clickDelegate>
@property(nonatomic, strong)BCPhonePopView *popView;
@end

@implementation BCOrderDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"订单详情";
    UIBarButtonItem *rightBut = [[UIBarButtonItem alloc] initWithTitle:@"查看地图" style:UIBarButtonItemStylePlain target:self action:@selector(goMap)];
    self.navigationItem.rightBarButtonItem = rightBut;
    BCOderDetailView *orderView = [[BCOderDetailView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    orderView.backgroundColor = [UIColor redColor];
    orderView.delegate = self;
    [self.view addSubview:orderView];
    // Do any additional setup after loading the view.
}

- (void)click:(NSNumber *)phoneNum
{
    
    if ( [[self.view.subviews lastObject] isKindOfClass:[BCPhonePopView class]]) {
        if (self.popView.hidden == NO) {
             self.popView.hidden = YES;
        }else{
            self.popView.hidden = NO;
        }
    }else{
        
        self.popView = [[BCPhonePopView alloc] initWithImg:[UIImage imageNamed:@"头像2"] name:@"李先生-大地春饼店" add:@"沙河口区高尔基路45号" phone:@15112345678];
        [self.view addSubview:self.popView];;
        
    }
   ;
    
    
    
}

- (void)goMap{
    BCCheckMapVC *map = [[BCCheckMapVC alloc] init];
    [self.navigationController pushViewController:map animated:YES];

}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    //隐藏导航栏
    self.navigationController.navigationBar.hidden = NO;
    
    if (!self.rdv_tabBarController.tabBarHidden) {
        [[self rdv_tabBarController] setTabBarHidden:YES animated:YES];
    }
}

-(void)viewWillDisappear:(BOOL)animated {
    if (self.rdv_tabBarController.tabBarHidden) {
        [[self rdv_tabBarController] setTabBarHidden:NO animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
